import { Random } from "mockjs"; // 导出随机函数
import Mock from "mockjs";

function createScenicSpot(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: {
      id: 2,
      name: "123",
      pictureUrl: "",
      description: "",
    },
  };
}

function updateScenicSpot(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: {},
  };
}

function deleteScenicSpot(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: {},
  };
}

function searchSingleScenicSpot(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: {
      id: "1",
      name: "123",
      pictureUrl: "aa",
      description: "1212",
      price: "18",
      belongCity: "",
      cityId: "",
    },
  };
}

function searchAllScenicSpot(req: any) {
  let { data } = Mock.mock({
    "data|1-6": [
      {
        id: "1",
        name: "@ctitle()",
        pictureUrl:
          "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
        description: "1212",
        price: "@Integer(20,100)",
        belongCity: "",
        cityId: "",
      },
    ],
  });

  console.log(data);

  return {
    success: true,
    message: "",
    code: "200",
    data: {
      data: data,
      total: 50,
    },
  };
}

function uploadImage(req: any) {
  return {
    success: true,
    message: "",
    code: "200",
    data: "",
  };
}

function showImage(req: any) {
  return {};
}

export default {
  createScenicSpot,
  updateScenicSpot,
  deleteScenicSpot,
  searchSingleScenicSpot,
  searchAllScenicSpot,
  uploadImage,
  showImage,
};
